package com.youxin.cpcenter.controller;

import com.youxin.busfoundation.bean.ResponseObject;
import com.youxin.cpcenter.common.log.LogMethod;
import com.youxin.cpcenter.service.RecommendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @desc 智能推荐控制器
 * @author Kris.wang
 * @date 2018-1-5
 */
@RestController
public class RecommendController extends BaseController{

    @Autowired
    private RecommendService recommendService;

    /**
     * @desc  智能推荐列表
     * @param request
     * @param httpServletResponse
     * @return
     */
    @LogMethod(id="ent.api.recommend.list",eventContent={})
    @RequestMapping(value = "/api/recommend/list", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public ResponseObject queryRecommendList(HttpServletRequest request, HttpServletResponse httpServletResponse)  {
        try {
            return recommendService.queryRecommendList();
        } catch (Exception e) {
            logger.error("/queryRecommendList", e);
            return ResponseObject.systemError(e);
        }
    }

}
